<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<div>
    <table id="wQbdTeamExpertgroupTable" lay-filter="wQbdTeamExpertgroupTable"></table>
    <form class="reportList-isShow">
        <input type="hidden" id="successDataId" name="successDataId">
    </form>
</div>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdTeamExpertgroupRightToolsBar">
    <a class="RightBtn" lay-event="particulars">详情</a>
</script>

<script>
    //一般直接写在一个js文件中
    layui.use(['index','table','publicMethods','jquery','layer'], function () {
        var table = layui.table;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;

        var tableH=publicMethods.layerHeight();
        var dataId = "${dataId}";

        var currentSystemLevel = "${currentSystemLevel}";
        var snCols = [{type: 'checkbox', fixed: 'left'},{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}];
        var fillDeptCols = [];
        if ("GROUPLEVEL" === currentSystemLevel) {
            fillDeptCols = [{field: 'filldeptHospital', title: '数据来源单位'}];
        } else if ("HOSPITALLEVEL" === currentSystemLevel) {
            fillDeptCols = [{field: 'filldept', title: '数据来源单位'}];
        } else if ("PLANTLEVEL" === currentSystemLevel) {
            fillDeptCols = [{field: 'filldept', title: '数据来源单位'}];
        }

        var reportStatusCols = [{
            field: 'reportStatusStr', title: '状态', hide: false, templet: function (d) {
                if (d.reportStatus == 18 || d.reportStatus == 10) {
                    return returnComments(d);
                } else {
                    return d.reportStatusStr;
                }

            }
        }];

        function returnComments(d) {
            return "<a style=\"cursor: pointer;color:red\" onclick=\"layer.open({title: '退回意见',content: '" + d.returnmsg + "'});\">" + d.reportStatusStr + "</a>";
        }

        //第一个实例
        table.render({
            elem: '#wQbdTeamExpertgroupTable'
            ,height:tableH
            ,url: serverPath.qbdmsPath + '/qbdms/wQbdTeamExpertgroup/reportList?id=' + dataId + "&tableName=w_qbd_team_expertgroup"
            ,page: false //开启分页
            // ,toolbar: '#wQbdTeamExpertgroupHeaderToolsBar'
            ,method: 'post'
            ,autoSort: false //是否排序
            ,cols: [[
                {type: 'checkbox', fixed: 'left'},
                {field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
                // ,{field: 'id', title: '主键',sort:true, sortname: 'id'}
                ,{field: 'name', title: '姓名',minWidth:110}
                ,{field: 'technical', title: '技术领域',minWidth:110}
                ,{field: 'workdept', title: '工作单位',minWidth:100}
                ,{field: 'groupduty', title: '组内职务',minWidth:100}
                ,{field: 'workindustry', title: '从事专业',minWidth:100}
                ,{field: 'classification', title: '专家类别',hide: true}
                ,{field: 'assessmentyear', title: '初评年度',hide: true}
                // ,{field: 'workdeptid', title: '工作单位id',sort:true, sortname: 'workdeptid'}
                ,{field: 'approvedyear', title: '核定年度',hide: true}
                ,{field: 'sex', title: '性别', hide: true}
                ,{field: 'age', title: '年龄', hide: true}
                ,{field: 'idnumber', title: '身份证号', hide: true}
                ,{field: 'nation', title: '民族', hide: true}
                ,{field: 'politicalaspects', title: '政治面貌', hide: true}
                ,{field: 'admpositions', title: '行政职务', hide: true}
                ,{field: 'techpositions', title: '技术职务', hide: true}
                ,{field: 'techtitle', title: '技术职称', hide: true}
                ,{field: 'major', title: '所学专业', hide: true}
                ,{field: 'mobile', title: '联系电话（手机）', hide: true}
                ,{field: 'tel', title: '办公室座机', hide: true}
                ,{field: 'iswork', title: '是否在职', hide: true}
                ,{field: 'workstatus', title: '退休/返聘', hide: true}
                ,{field: 'address', title: '通讯地址', hide: true}
                ,{field: 'remark', title: '备注', hide: true}
                ,{field: 'recommendfile', title: '推荐表', hide: true}
                ,{field: 'secret', title: '密级', hide: true}
                ,{
                    fixed: 'right',
                    title: '管理',
                    align:'center',
                    width:80,
                    toolbar: '#wQbdTeamExpertgroupRightToolsBar'
                }]],done:function () {
            }
        });

        table.on('tool(wQbdTeamExpertgroupTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                    layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "particulars":
                    var height=publicMethods.layHeight('body');
                   layer.open({
                        type: 2,
                       area: ['96%', height],
                        title: ['专家信息详情'],
                        content: serverPath.qbdmsPath + '/qbdms/wQbdTeamExpertgroup/view/particulars?id=' + data.id + "&isClose=true"
                    });
                    break;
            }
        });

        table.on('checkbox(wQbdTeamExpertgroupTable)', function (obj) {
            if (obj.type == "all") {
                if (obj.checked) {
                    $("input[name='successDataId']").val("");
                    var checkStatus = table.checkStatus('wQbdTeamExpertgroupTable');
                    var valArr = checkStatus.data;//选中行数据
                    var ceshiVal = $("input[name='successDataId']").val();
                    for (var i = 0; i < valArr.length; i++) {
                        ceshiVal = ceshiVal + valArr[i].id + ",";
                    }
                    $("input[name='successDataId']").val(ceshiVal);
                } else {
                    $("input[name='successDataId']").val("");
                }
            } else {
                if (obj.checked) {
                    var ceshiVal = $("input[name='successDataId']").val();
                    $("input[name='successDataId']").val(ceshiVal + obj.data.id + ",");
                } else {
                    var ceshiVal = $("input[name='successDataId']").val();
                    var newVal = "";
                    var valArr = ceshiVal.split(obj.data.id + ",");
                    for (var i = 0; i < valArr.length; i++) {
                        newVal += valArr[i];
                    }
                    $("input[name='successDataId']").val(newVal);
                }
            }
        });


    });
</script>
</body>
</html>